<div class="list_nav">
    <div class="wrap ">
        <div class="list_tit">
            <div class="dressing">
                <dl>

                    <dt>列表类型</dt>
                    <dd><a href="<?php echo url_for('project/list?type=0')?>" <?php if($get_type == 0):?>class=on <?php endif;?>>全部</a></dd>
                    <?php if(!empty($type_list)):?>
                        <?php foreach($type_list as $id=>$name):?>
                            <dd><a href="<?php echo url_for("project/list?type=".$id."&dete_line=".$get_dete_line."&status=".$get_status)?>" <?php if($get_type == $id):?>class=on <?php endif;?>><?php echo $name ?></a></dd>
                        <?php endforeach;?>
                    <?php endif;?>
                </dl>
                
                <dl>
                    <dt>借款期限</dt>
                    <?php if(!empty($date_line)):?>
                        <?php foreach($date_line as $key=>$one_date_line):?>
                            <dd><a href="<?php echo url_for("project/list?type=".$get_type."&dete_line=".$key."&status=".$get_status)?>" <?php if($get_dete_line == $key):?>class=on <?php endif;?>><?php echo $one_date_line?></a></dd>
                        <?php endforeach;?>
                    <?php endif;?>
                </dl>
                <dl>
                    <dt>列表状态</dt>
                    <?php if(!empty($status)):?>
                        <?php foreach($status as $key=>$one_status):?>
                            <dd><a href="<?php echo url_for("project/list?type=".$get_type."&dete_line=".$get_dete_line."&status=".$key)?>" <?php if($get_status == $key):?>class=on <?php endif;?>><?php echo $one_status?></a></dd>
                        <?php endforeach;?>
                    <?php endif;?>
                </dl>
                
            </div>
            <div class="dressing-r">
                <?php if ($sf_user->isAuthenticated()): ?>
                <div>可用余额<a href="<?php echo url_for("account/recharge"); ?>"> <?php echo sfConfig::get('app_symbol').number_format($remaining_money->getRemainingMoney(), 2)?> </a></div>
                <?php else:?>
                <div><span class="ft-l">您尚未登录 </span><a href="<?php echo url_for('user/login')?>" class="add"></a></div>
                <?php endif;?>
                <div><i class="icon20_b icon_culator"></i><a href="" data-toggle="modal" data-target="#projectlistmodel">收益计算器</a></div>
            </div>
        </div>
    </div>
    <div class="wrap">

            <?php foreach($pager->getResults() as $k=>$result): ?>
        <div onclick="window.location.href='<?php echo url_for('project/index?id='.$result->getId())?>';" class="panel panel-primary list_item <?php if($k%2 == 0):?>nth<?php endif;?>">
                <div class="panel-heading">
                    <h3 class="panel-title ft-l"><a href="<?php echo url_for('project/index?id='.$result->getId())?>"><?php echo $result->getTitle();?></a></h3>
                   <span class="icon20_b <?php echo Loan::$list_type_class_name[$result->getListType()]; ?> ft-r" title="<?php echo $result->getListTypeToString() ?>"></span>
                </div>
                <div class="panel-body">
                    <div>
                        <div class="ft-l">
                            <div class="chart">
                               <?php if($result->getStatus() == 1):?>
                                   <canvas class="" progress="<?php echo bcdiv($result->getRemainder(),$result->getMoney(),4)*100 ?>" height="90" width="90" name="Chart" style="width: 90px; height: 90px;"></canvas>
                                <?php endif;?>
                                 <?php if($result->getStatus() == 2):?>
                                   <img src="<?php echo image_path('lend/lendman.png')?>" class="lending" />
                               <?php endif;?>   
                                <?php if($result->getStatus() == 3):?>
                                   <img src="<?php echo image_path('lend/lendman.png')?>" class="lending" />
                                <?php endif;?>   
                                <?php if($result->getStatus() == 4):?>
                                   <img src="<?php echo image_path('lend/lending.png')?>" class="lending" />
                               <?php endif;?>
                               <?php if($result->getStatus() == 5):?>
                                   <img src="<?php echo image_path('lend/lendok.png')?>" class="lending" />
                               <?php endif;?>
                               <?php if($result->getStatus() == 6):?>
                                   <img src="<?php echo image_path('lend/lendlost.png')?>" class="lending" />
                               <?php endif;?> 
                               <?php if($result->getStatus() == 7):?>
                                   <img src="<?php echo image_path('lend/lendlost.png')?>" class="lending" />
                               <?php endif;?> 
                                   
                            </div>
                            <div class="alt">
                                已融资金额 <span><?php echo sfConfig::get('app_symbol').number_format($result->getRemainder(),2);?></span><br />
                                剩余时间 
                                <label class="date">
                                   <?php if($result->getStatus() == 1): ?>
                                <?php $end_time = $result->getTime();?>
                                    <?php if(strtotime($end_time) < time()):?>
                                    已经结束
                                    <?php else:?>
                                        <?php echo $end_time;?>
                                    <?php endif;?>
                                     <?php else: ?>
                                        已经结束
                                        <?php endif; ?>
                                </label>
                            </div>
                        </div>
                        <div class="ft-r">
                            <ul class=" list-group m-page">
                                <li class="list-group-item"><span class="icon20_g icon_money ft-l"></span><span class="l-t">融资金额</span><span><?php echo sfConfig::get('app_symbol').number_format($result->getMoney(),  sfConfig::get('app_value_bit'));?></span></li>

                                <li class="list-group-item"><span class="icon20_g icon_barchart ft-l"></span><span class="l-t">年化利率</span><span class="c-y">
                                        <?php if($result->getListType() == 1):?>
					<?php echo $result->getMoneyRate()-2?>%+ 2%
                                            <?php else:?>
                                            <?php echo number_format($result->getMoneyRate(),2)."%"?>
                                        <?php endif;?>
                                    </span></li>
                                <li class="list-group-item"><span class="icon20_g icon_notepad ft-l"></span><span class="l-t">融资期限</span><span><?php echo $result->getTermNumToString() ?></span></li>
                            </ul>
                                <?php if($result->getStatus() == 1):?>
                                    <a class="btn btn-primary" href="<?php echo url_for('project/index?id='.$result->getId())?>">马上投资</a>
                                <?php else:?>
                                    <a href="<?php echo url_for('project/index?id='.$result->getId())?>" class="btn btn-default">查看详情</a>
                                <?php endif;?>
                        </div>
                    </div>
                </div>
            </div>
            <?php endforeach;?>
          <div style="clear:left;"></div>
            <?php $uri = url_for("project/list?type=".$get_type."&dete_line=".$get_dete_line."&status=".$get_status)?>
            <ul class="pagination pagination-lg ft-r">
            <?php echo pager_navigation($pager, $uri); ?>
            </ul>

        
    </div>
</div>

<script type="text/javascript">
    $("#10001").addClass("on");
    $(".main").addClass("projectlist");
    $(function($) {
        setTimeout("setchart()", 1000);
    });
    function setchart() {
        var ctx;
        var data;
        $("canvas[name='Chart']").each(function() {
            $(this).prev().hide();
            $(this).attr('class', '');
            ctx = $(this).get(0).getContext("2d");
            data = [{ value: Number($(this).attr('progress')), color: "#3399ff" }, { value: Number(100 - $(this).attr('progress')), color: "#F2F2F2" }];
            new Chart(ctx).Doughnut(data, { size: 102 });

        });
    }
    if ($(".date").length > 0) {
        $(".date").each(function () {
            if ($(this).text() != "已经结束"){
            var today = new Date($(this).text()), tomorrow = Math.round(today / 1000);
            $(this).scojs_countdown({ until: tomorrow });
            }
        });
    }
</script>